import {
	ref
} from "vue"
export default function useComment(data) {
	//处理评论的交互事件
	const {
		commentData
	} = data;
	const replyContent = ref('')
	//点击回复按扭。
	const reply = () => {
		// 创建新对象避免引用问题
		const currentComment = commentData.comment || commentData;
		replyContent.value = {
			comment_id: currentComment.comment_id,
			is_reply: commentData.isReply || false,
			// 存储回复目标的用户信息，用于显示@符号
			reply_to_user: currentComment.author?.author_name || '',
			// 当前为回复内容的时候添加回复的ID
			reply_id: currentComment.reply_id || null
		};
	};
	return {
		reply,
		replyContent
	};
}